<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Swiper Image Carousel</title>
    <link href="{HOME_THEME_PATH}css/swiper-3.4.2.min.css" rel="stylesheet" media="screen" type="text/css">
    <style>
        .swiper-container {
            width: 100%;
            height: 300px;
        }

        .swiper-slide {
            text-align: center;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .swiper-slide img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            cursor: pointer;
            transition: transform 0.3s ease-in-out;
        }

        /* 点击图片放大的样式 */
        .swiper-slide img.enlarge {
            transform: scale(1.5);
            z-index: 9999;
        }
        
    </style>
</head>
<body>
    <div class="swiper-container">
        <?php $ryzs=dr_site_value('ryzs');?>
        <div class="swiper-wrapper">
            <?php if ($ryzs) { $key=0; foreach ($ryzs as $c) { ?>
            <div class="swiper-slide"><img src="{dr_get_file($c)}" alt="Image 1"></div>
            <?php $key++;} } ?>
        </div>
        <!-- 添加左右导航按钮 -->
        <div class="swiper-button-next"></div>
        <div class="swiper-button-prev"></div>
    </div>

    <!-- Swiper.js Library -->
    <script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
    <script>
        var swiper = new Swiper('.swiper-container', {
        slidesPerView: 4,
        spaceBetween: 10,
        autoplay: 5000,
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        },
        breakpoints: {
            // when window width is >= 320px
            320: {
                slidesPerView: 1,
                spaceBetween: 10
            },
            // when window width is >= 640px
            640: {
                slidesPerView: 2,
                spaceBetween: 20
            },
            // when window width is >= 768px
            768: {
                slidesPerView: 3,
                spaceBetween: 20
            },
            // when window width is >= 1024px
            1024: {
                slidesPerView: 4,
                spaceBetween: 30
            }
        }
    });
    </script>
    
</body>
</html>
